﻿using System;
using System.IO.IsolatedStorage;

namespace Core.Infrastructure.Settings
{
    public class Settings : ISettings
    {
        public Settings()
        {
            LoadSettings();
        }
        
        private void LoadSettings()
        {
            try
            {
                this.SettingsModel = IsolatedStorageSettings.ApplicationSettings["settings"] as SettingsModel;
            }
            catch (Exception)
            {
                //Defaults here
                this.SettingsModel = new SettingsModel { FullScreen = true };
            }
        }

        public void SaveSettings()
        {
            IsolatedStorageSettings.ApplicationSettings["settings"] = this.SettingsModel;
        }

        public SettingsModel SettingsModel { get; set; }
    }
}
